/*
 * @Description: 害虫管理和虫情预警配置
 */
// import zhreq from "@/api/axios";
import zhreqtwo from "@/api/axios";
export default {
  // -------害虫管理--------
  /**
   * @description: 获取列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @param {Object} entity {componyId: 1} *
   * @param {String} order 排序方式 ASC DESC 默认ASC
   * @param {String} sort 自定义排序方式 'createTime'
   * @return {Array}
   */
  getpestList(params) {
    let searchparams = {
      page: params.page,
      size: params.size,
      sort: "timestamp",
      entity: {
        pestNameLike: params.pestName,
        organizationNo: sessionStorage.organizationNo
      }
    }
    return zhreqtwo.post("v3/insectSituation/pest/queryPageList", searchparams);
  },
  // 查询所有虫子名称
  getallpestnamelist() {
    return zhreqtwo.get('v3/insectSituation/insectCollectionResult/queryPestName')
  },
  // 害虫添加接口
  addnewpestmessage(param) {
    return zhreqtwo.post("v3/insectSituation/pest/add ", param);
  },
  // 害虫修改接口
  editnewpestmessage(param) {
    return zhreqtwo.post("v3/insectSituation/pest/edit ", param);
  },
  // 害虫批量删除接口
  delnewpestmessage(param) {
    return zhreqtwo.post("v3/insectSituation/pest/delList ", {
      pestIdList: param
    });
  },
  // 害虫查询接口
  querynewpestmessage(param) {
    return zhreqtwo.post("v3/insectSituation/pest/queryByCondition ", {
      harm: true,
      organizationNo: sessionStorage.organizationNo
    });
  },
  // 添加虫害预警
  addalarmpestmessage(params) {
    return zhreqtwo.post("v3/insectSituation/pestAlarmlevel/addBatch", params);
  },
  // 表格查询虫害预警
  getalarmpestlist(params) {
    let searchparams = {
      page: params.page,
      size: params.size,
      sort: "timestamp",
      entity: {
        organizationNo: sessionStorage.organizationNo
      }
    }
    return zhreqtwo.post("v3/insectSituation/pestAlarmlevel/queryPageList", searchparams);
  },
  // 批量删除虫害预警
  delalarmpestmessage(param) {
    return zhreqtwo.get("v3/insectSituation/pestAlarmlevel/delListById", {
      params: {
        'pestIdList': param.toString()
      }
    });
  },
  // 批量修改虫害预警
  editalarmpestmessage(params) {
    return zhreqtwo.post("v3/insectSituation/pestAlarmlevel/editBatch", params);
  },
  // 条件查询虫害预警
  querYalarmpestmessage(params) {
    return zhreqtwo.post("v3/insectSituation/pestAlarmlevel/queryByCondition", params);
  },
  // 根据虫害名称，虫害数量，组织结构获取告警等级
  getnowalarmpest(param) {
    return zhreqtwo.get("v3/insectSituation/pestAlarmlevel/queryAlarm", {
      'params': { ...param }
    });
  },
  // 获取整体信息--2023-8-2
  queyAllPestInfoList(params) {
    return zhreqtwo.post('v3/insectSituation/insectCollectionResult/queryPestsNumberByTime',params)
  }
};
